﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JobConfig.aspx.cs" Inherits="Admin.SpiderConfig.JobConfig" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
	<form id="form1" runat="server">
		<asp:Panel ID="panelGatherSettings" runat="server">
			<div>
			任务名称:<asp:TextBox ID="tbJobName" runat="server" Width="120"></asp:TextBox>
			URL种子:<asp:TextBox ID="tbSeedUrls" runat="server" Width="250"></asp:TextBox>
			编码:<asp:TextBox ID="tbEncoding" runat="server" Width="50" Text="utf-8"></asp:TextBox>
			<asp:Button ID="btnAddJob" runat="server" Text="增加" OnClick="btnAddJob_Click"  />
			</div>
			<asp:GridView ID="gvJob" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="JobId"
				ForeColor="#333333" GridLines="None" OnRowCancelingEdit="gvGatherSettings_RowCancelingEdit"
				OnRowDataBound="gvGatherSettings_RowDataBound" OnRowDeleting="gvGatherSettings_RowDeleting"
				OnRowEditing="gvGatherSettings_RowEditing" OnRowUpdating="gvGatherSettings_RowUpdating" OnRowCommand="gvGatherSettings_RowCommand">
				<FooterStyle BackColor="#507CD1" Font-Bold="True" Font-Size="12px" ForeColor="White" />
				<RowStyle BackColor="#EFF3FB" />
				<EditRowStyle BackColor="#2461BF" />
				<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
				<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
				<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Width="100%" />
				<AlternatingRowStyle BackColor="White" />
				<Columns>
					<asp:TemplateField HeaderText="任务ID" HeaderStyle-Width="50">
						<ItemTemplate>
							<%# Eval("JobId")%>
						</ItemTemplate>
						<HeaderStyle Width="100px" />
					</asp:TemplateField>
					<asp:TemplateField HeaderText="任务名称" HeaderStyle-Width="150">
						<ItemTemplate>
							<asp:LinkButton ID="LinkButton1" CommandName="show_filerule" runat="server" CommandArgument='<%# Eval("JobId")%>' ><%# Eval("Name")%></asp:LinkButton>
						</ItemTemplate>
						<EditItemTemplate>
							<asp:TextBox ID="tbName" runat="server" Width="130" Text='<%# Eval("Name") %>'></asp:TextBox>
						</EditItemTemplate>
						<HeaderStyle Width="130" />
					</asp:TemplateField>
					<asp:TemplateField HeaderText="URL种子" HeaderStyle-Width="300" >
						<ItemTemplate>
							<%# Eval("Urls") %>
						</ItemTemplate>
						<EditItemTemplate>
							<asp:TextBox ID="tbUrls" runat="server" Width="280" Rows="4" TextMode="MultiLine" Text='<%# Eval("Urls") %>'></asp:TextBox>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:TemplateField HeaderText="编码">
						<ItemTemplate>
							<%# Eval("encoding") %>
						</ItemTemplate>
						<EditItemTemplate>
							<asp:TextBox ID="tbEncoding" runat="server" Width="50" Text='<%# Eval("Encoding") %>'></asp:TextBox>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:TemplateField HeaderText="状态">
						<ItemTemplate>
							<%# Eval("StatusString") %>
						</ItemTemplate>
					</asp:TemplateField>
					<asp:TemplateField HeaderText="操作">
						<ItemTemplate>
							<asp:LinkButton ID="lbStart" CommandName="StartJob" runat="server" CommandArgument='<%# Eval("JobId")%>' Text="启动"></asp:LinkButton>
						</ItemTemplate>
					</asp:TemplateField>
					<asp:CommandField ShowEditButton="True" />
					<asp:CommandField ShowDeleteButton="True" />
				</Columns>
			</asp:GridView>
		</asp:Panel>
		
		
		<asp:Panel ID="panelFileRule" runat="server">
			<div>
			<asp:LinkButton ID="lbGotoSettings" runat="server" OnClick="lbGotoSettings_Click">返回</asp:LinkButton>
			名称:<asp:TextBox ID="tbFileName" runat="server" Width="120"></asp:TextBox>
			URL规则:<asp:TextBox ID="tbFilePattern" runat="server" Width="120"></asp:TextBox>
			是否加载链接:
			<asp:DropDownList ID="ddIsLoad" runat="server">
				<asp:ListItem Text="是" Value="1" />
				<asp:ListItem Text="否" Value="0" />
			</asp:DropDownList>
			<asp:Button ID="btnAddFileRule" runat="server" Text="增加" OnClick="btnAddFileRule_Click"  />
			</div>
			<asp:GridView ID="gvFileRule" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="FileId"
				ForeColor="#333333" GridLines="None" OnRowCommand="gvFileRule_RowCommand" OnRowDataBound="gvFileRule_RowDataBound" OnRowDeleting="gvFileRule_RowDeleting" OnRowEditing="gvFileRule_RowEditing" OnRowUpdating="gvFileRule_RowUpdating" OnRowCancelingEdit="gvFileRule_RowCancelingEdit">
				<FooterStyle BackColor="#507CD1" Font-Bold="True" Font-Size="12px" ForeColor="White" />
				<RowStyle BackColor="#EFF3FB"  />
				<EditRowStyle BackColor="#2461BF" />
				<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
				<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
				<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Width="100%" />
				<AlternatingRowStyle BackColor="White" />
				
				<Columns>
					<asp:TemplateField HeaderText="文件ID" HeaderStyle-Width="50">
						<ItemTemplate>
							<%# Eval("FileId")%>
						</ItemTemplate>
						<HeaderStyle Width="100px" />
					</asp:TemplateField>

					<asp:TemplateField HeaderText="名称" HeaderStyle-Width="150">
						<ItemTemplate>
							<asp:LinkButton ID="LinkButton3" CommandName="show_fieldrule" runat="server" CommandArgument='<%# Eval("FileId")%>' ><%# Eval("Name").ToString().Replace("<", "&lt;").Replace(">", "&gt;")%></asp:LinkButton>
						</ItemTemplate>
						<EditItemTemplate>
							<asp:TextBox ID="tbName" runat="server" Width="150" Text='<%# Eval("Name") %>'></asp:TextBox>
						</EditItemTemplate>
					</asp:TemplateField>

					<asp:TemplateField HeaderText="文件规则" HeaderStyle-Width="280">
						<ItemTemplate>
							<%# Eval("UrlPattern")%>
						</ItemTemplate>
						<EditItemTemplate>
							<asp:TextBox ID="tbFilePattern" runat="server" Width="270" Text='<%# Eval("UrlPattern") %>'></asp:TextBox>
						</EditItemTemplate>
					</asp:TemplateField>

					
					
					<asp:TemplateField HeaderText="是否加载链接">
						<ItemTemplate>
						</ItemTemplate>
						<EditItemTemplate>
							<asp:DropDownList ID="ddIsLoad" runat="server">
								<asp:ListItem Text="是" Value="1" />
								<asp:ListItem Text="否" Value="0" />
							</asp:DropDownList>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:CommandField ShowEditButton="True" />
					<asp:CommandField ShowDeleteButton="True" />
				</Columns>
			</asp:GridView>
		</asp:Panel>
		
		
		<asp:Panel ID="panelFieldRule" runat="server">
			<div>
			<asp:LinkButton ID="lbGotoFileRule" runat="server" OnClick="lbGotoFileRule_Click">返回</asp:LinkButton>
			名称:<asp:TextBox ID="tbFieldName" runat="server" Width="120"></asp:TextBox>
			字段名:<asp:TextBox ID="tbFieldCode" runat="server" Width="120"></asp:TextBox>
			字段规则:<asp:TextBox ID="tbFieldXPath" runat="server" Width="250"></asp:TextBox>
			<asp:Button ID="btnAddFieldRule" runat="server" Text="增加" OnClick="btnAddFieldRule_Click" />
			</div>
			<asp:GridView ID="gvFieldRule" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="FieldId"
				ForeColor="#333333" GridLines="None" OnRowDataBound="gvFieldRule_RowDataBound" OnRowDeleting="gvFieldRule_RowDeleting" OnRowEditing="gvFieldRule_RowEditing" OnRowUpdating="gvFieldRule_RowUpdating" OnRowCancelingEdit="gvFieldRule_RowCancelingEdit" >
				<FooterStyle BackColor="#507CD1" Font-Bold="True" Font-Size="12px" ForeColor="White" />
				<RowStyle BackColor="#EFF3FB" />
				<EditRowStyle BackColor="#2461BF" />
				<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
				<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
				<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Width="100%" />
				<AlternatingRowStyle BackColor="White" />
				<Columns>
					<asp:TemplateField HeaderText="字段ID">
						<ItemTemplate>
							<%# Eval("FieldId")%>
						</ItemTemplate>
						<HeaderStyle Width="100px" />
					</asp:TemplateField>
					<asp:TemplateField HeaderText="名称">
						<ItemTemplate>
							<%# Eval("Name").ToString().Replace("<", "&lt;").Replace(">", "&gt;")%>
						</ItemTemplate>
						<EditItemTemplate>
							<asp:TextBox ID="tbName" runat="server" Width="100" Text='<%# Eval("Name") %>'></asp:TextBox>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:TemplateField HeaderText="字段名">
						<ItemTemplate>
							<%# Eval("Code")%>
						</ItemTemplate>
						<EditItemTemplate>
							<asp:TextBox ID="tbCode" runat="server" Width="100" Text='<%# Eval("Code") %>'></asp:TextBox>
						</EditItemTemplate>
						<HeaderStyle Width="120" />
					</asp:TemplateField>
					<asp:TemplateField HeaderText="XPath">
						<ItemTemplate>
							<%# Eval("XPath").ToString().Replace("<", "&lt;").Replace(">", "&gt;")%>
						</ItemTemplate>
						<EditItemTemplate>
							<asp:TextBox ID="tbXPath" runat="server" Width="450" Text='<%# Eval("XPath") %>'></asp:TextBox>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:CommandField ShowEditButton="True" />
					<asp:CommandField ShowDeleteButton="True" />
				</Columns>
			</asp:GridView>
		</asp:Panel>
	</form>
</body>
</html>
